<template>
	<view class="tabbarlist">
		<view :class="countindex == index ? 'active' :''" v-for="(item,index) in list" :key="index"
			@tap="TapTabbarClick(index)">
			<view :class="item.icon"><text>{{item.title}}</text></view>
		</view>
	</view>
</template>

<script>
	export default {
		name: "qi-Tabbar",
		props: {
			"countindex": {
				type: String | Number,
				default: 0
			}
		},
		data() {
			return {
				list: [{
						icon: 'iconfont icon-shouye',
						title: '首页',
					},
					{
						icon: 'iconfont icon-xitong',
						title: '分类',
					},
					{
						icon: 'iconfont icon-icon-test10',
						title: '购物车',
					},
					{
						icon: 'iconfont icon-wode',
						title: '我的',
					},
				]
			};
		},
		methods: {
			TapTabbarClick(index) {
				switch (index) {
					case 0:
						index == 0
						uni.navigateTo({
							url: '/pages/index/index'
						});
						break;
					case 1:
						index == 1
						uni.navigateTo({
							url: '/pages/goods/goods'
						});
						break;
					case 2:
						index == 2
						uni.navigateTo({
							url: '/pages/cart/cart'
						});
						break;
					case 3:
						index == 3
						uni.navigateTo({
							url: '/pages/mine/mine'
						});
						break;
				}

			}
		}
	}
</script>

<style lang="scss" scoped>
	.tabbarlist {
		background-color: #f6f6f6;
		position: fixed;
		left: 0;
		right: 0;
		bottom: 0;
		box-shadow: 0 -1px 1px rgba(100, 100, 100, .2);
		z-index: 99;
		height: 50px;
		// width: 100%;
		display: flex;
		justify-content: space-around;
		align-items: center;

		.iconfont {
			// font-size: 16px;
			display: flex;
			flex-direction: column;
			justify-content: center;
			align-items: center;

			text {
				// font-size: 12px;
			}
		}

		.active {
			color: red;
		}
	}
</style>